package file;

import java.io.File;
import java.io.FileFilter;

//以D开头的子项
public class Test {
    public static void main(String[] args) {
        File file=new File("./src/main/java/file");
        if (file.isDirectory()){
           /* FileFilter filter=new FileFilter() {
                public boolean accept(File file1) {
                    String name=file1.getName();
                    return name.startsWith("D");
                }
            };
            File[] f=file.listFiles(filter);
            for (File sub:f){
                System.out.println(sub.getName());
            }*/
            File[] f=file.listFiles(file1->file1.getName().startsWith("D"));
        }
    }
}
